home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MACD 5
/
MACD 5.bin
/
internet
/
irc_i_dodatki
/
mcf4amirc
/
rexx
/
mcf.amirx
< prev
next >
Wrap
Text File
|
1996-12-25
|
15KB
|
13 lines
/* MCF.AMIRX
// $VER: MCF.AMIRX 4.12 (25.12.96)
\\ Written by Donald T. Becker (dtbecker@prolog.net) IRC: StarDustr
// Please mail any bug reports/comments to the above address with a subject
\\ header of MCF.AMIRX.
//
\\ ** What to do with this file? Put this script in REXX:
//
\\ What else to do with this file... (if not Auto-started by MCF_JOIN.AMIRX)
// Put this script in REXX:, connect to an IRC server and type /Rx MCF args
\\ where args are: NOOPS/S FSERV/S NOSOUND/S NORCMDS/S GREETS/S
*/
;flag=getclip("MCF");if flag='Y' then exit;call setclip("MCF",'Y');arg argline;OPTIONS RESULTS;if 0~=pos("AMIRC",argline) then address value(argline);if ~show('L',"rexxsupport.library") then;do;if ~addlib("rexxsupport.library",0,-30,0) then;do;call setclip("MCF");exit 10;end;end;MCFenv=address();if 0=pos("AMIRC.",MCFenv) then call FindPort();address value(MCFenv);if getclip(MCFenv)='Y' then;do;"echo P="d2c(27)"««MCF»" d2c(2)"WARNING"d2c(2)" Master Control Functions already loaded.";"echo P="d2c(27)"««MCF» ! Multiple copies of "d2c(2)"MCF"d2c(2)" are now running.";"echo P="d2c(27)"««MCF» ! "d2c(2)"Quit MCF"d2c(2)" to avoid problems, then Re-Start.";end;xl=pos(".",MCFenv)+1;Client=substr(MCFenv,xl);ChCount=0;EnvFName="MCF:MCF.StartUp";Cname="MCF:MCF.Cmds";fname="MCF:MCF.Ops";DeCode="DeCoded";SoundDir="Sounds:";SoundPlayer="C:Play16";AJOIN="N";ASEND="Y";FSERV="N";GREETS="N";OPS="Y";RCMDS="Y";SOUNDS="Y";PSOUND="N";NOSOUNDS="2";DCCGET="N";DCCDIR="Ram:";SPEAK="N";SPEAKPLAYER="SYS:Utilities/Say";OPCHAR.Client="@";IGN="IGNORE."||Client;CMC="CMDS."||Client;FSC="FSERV."||Client;GRC="GREETS."||Client;OPC="OPS."||Client;OCC="OPCHAR."||Client;OLC="OPLINE."||Client;RCC="RCMDS."||Client;SCC="SOUNDS."||Client;PSC="PSOUND."||Client;NSC="NOSOUNDS."||Client;DCC="DCCGET."||Client;DSC="DCCSOUNDS."||Client;SAC="SABUSER."||Client;SPC="SOUNDPLAYER."||Client;SDC="SOUNDDIR."||Client;validnames=" SPEAKPLAYER SOUNDDIR SOUNDPLAYER DCCDIR NOSOUNDS GREETS PSOUND FSERV OPS RCMDS SOUNDS AJOIN ASEND DCCGET SPEAK ";valid_df=" SPEAKPLAYER SOUNDDIR SOUNDPLAYER DCCDIR ";valid_yn=" FSERV OPS RCMDS SOUNDS AJOIN ASEND DCCGET SPEAK PSOUND ";valid_clips=" NOSOUNDS OPS FSERV GREETS DCCGET OPCHAR RCMDS SOUNDS AJOIN DCCDIR PSOUND SOUNDDIR SOUNDPLAYER ";if exists(EnvFName) then call EnvLoad;call setclip(OCC,OPCHAR.Client);call setclip(MCFenv,"Y");call RU();PCH="PRIVCH."||Client;call setclip(PCH,PRIVCH.Client);call RC();address command "Run >nil: Rx Rexx:MCF_PROTECT.AMIRX" MCFenv;amode="";vchar='!'||'01'x||"®©#%@";EFname="MCF:MCF.Encrypt";if ~open("Input",EFname,'R') then;do;"echo P="d2c(27)"««ERROR»" d2c(2) "MCF:MCF.Encrypt file not found.";signal Loaded;end;ALine.1=readln("Input");ALine.2=readln("Input");call setclip("ALINE.1",ALine.1);call setclip("ALINE.2",ALine.2);do cnt2=0 by 1 until cnt2=10;ELine.cnt2=readln("Input");call setclip("ELINE."cnt2,ELine.cnt2);end cnt2;call close("Input");Loaded:;"echo P="d2c(27)"««MCF» Master Control Functions are now loaded.";call setclip("MCF");do forever;getline;APort=show('P',value(MCFenv));if APort=0 then;do;MyNick="X";signal QUIT;end;lpos=pos("!",line.prefix)-1;if lpos<0 then;do;if line.command=332 then call EntryTopic();iterate;end;Unick=substr(line.prefix,1,lpos);Rnick=upper(Unick);getmynick;MyNick=upper(RESULT);if Rnick ~=MyNick then;do;ignored=getclip(IGN);lpos=lastpos('@',line.prefix)+1;ignIP=upper(substr(line.prefix,lpos));if 0 ~=pos(ignIP,ignored) then iterate;end;cmdchr=substr(line.rest,2,1);cmdpos=pos(cmdchr,vchar);if cmdpos>0 then;do;line.rest=translate(line.rest,' ','<>`');parse value line.rest with lslit therest;lslit=upper(lslit);XCall=Entry||cmdpos;interpret "call" XCall"()";end;end;exit;Entry1:;slit=":!"||MyNick;if slit=lslit then;line.rest=':'||'01'x||"GETSOUND"||therest;else return;Entry2:;line.rest=translate(line.rest,' ','01'x);if upper(line.command) ~="PRIVMSG" then return;xx=upper(line.rest);xc=substr(xx,3);parse value line.rest with junk junk ctcprest;parse value xc with ctcpfunc junk;if 0=pos(ctcpfunc,CTCP_Cmds) then return;DoCmd="Run >nil: Rx Rexx:MCF_"||ctcpfunc||".AMIRX ";select;when ctcpfunc="SOUND" then;do;parse value xc with xc1 junk xc3;if SOUNDS.Client="Y" then;address command DoCmd MCFenv Unick xc1 ctcprest;return;end;when ctcpfunc="GETSOUND" then;do;if ASEND ~='Y' then return;end;when ctcpfunc="DCC" then;do;if DCCGET.Client ~='Y' then return;parse value ctcprest with dccfunct dccfile junk;if dccfunct ~="SEND" then return;UValue=getclip(upper(dccfile));if UValue="" then return;"Say /DCC GET" Unick dccfile DCCDIR|| dccfile;return;end;otherwise continue;end;address command DoCmd MCFenv SoundDir Unick ctcprest;return;EntryTopic:;parse value line.rest with junk line.rest;line.rest=strip(line.rest);tcrypt=substr(line.rest,2,1);if tcrypt ~="©"&tcrypt ~="®" then return;DeCode="Topic";if tcrypt="©" then;call Entry4();else call Entry3();DeCode="DeCoded";return;Entry3:;emode=substr(line.rest,3,1);if datatype(emode) ~='NUM' then return;amode=2;aepos=4;Entry4:;if amode="" then;do;amode=1;emode=10;aepos=3;end;eline=substr(line.rest,aepos);if 0 ~=length(eline) then;do;xdata=reverse(translate(eline,ALine.amode,ELine.emode));odata="";do encnt=1 by 1 until xdata="";parse value xdata with xdat1 xdat2 xdata;odata=odata xdat1 reverse(xdat2);end;if DeCode="Topic" then;"echo P="d2c(27)"««"|| DeCode||"» "odata;else "echo P="d2c(27)"««"||Unick||"» "odata;end;amode="";return;Entry5:;if AJOIN.Client ~="Y" then return;if line.command ~="INVITE" then return;jchan=substr(line.rest,2);"Say /Join "jchan;return;Entry6:;slit=":%"||MyNick;if slit=lslit then;line.rest=":%"||strip(therest,'L');idata=upper(line.rest)||" ";spos=pos(" ",idata)-2;Rcmd=substr(idata,2,spos);rpos=pos(Rcmd,CmdLine);if rpos=0 then return;Rauth=substr(CmdLine,rpos-3,2);auth="";if MyNick=Rnick then auth=99;if auth="" then;do;Dst=upper(line.dest);if 0 ~=pos(":", Dst) then Dst=substr(Dst,2);COP="O"|| Dst||"."||Client;OPsLine=getclip(COP);if 0=pos(Dst,PRIVCH.Client) then;OPsLine=OPsLine||OpLine;npos=pos("@",line.prefix);Uname=upper(left(line.prefix,npos));UIP=upper(substr(line.prefix,npos+1));apos=1;do cauth=1 by 1 until auth ~="";upos=pos(Uname,OPsLine,apos);if upos=0 then auth=00;if auth="" then;do;apos=upos+npos+1;ipos=pos(" ",OPsLine,apos);OIP=substr(OPsLine,apos,ipos-apos);if 0 ~=pos(OIP,UIP) then;auth=substr(OPsLine,upos-3,2);end;end cauth;end;if auth<Rauth then return;Rcmd=substr(Rcmd,2,spos-1);RxCmd="Run >nil: Rx Rexx:MCF_"||Rcmd||".AMIRX ";if Rauth=99 then;do;interpret "CALL" Rcmd;return;end;if RCMDS.Client ~="Y" then return;if Rauth<30 then;do;address command RxCmd MCFenv auth Unick line.rest;return;end;if MyNick= Dst then return;opnick=" "||MyNick||" ";call GetCurrUsers();if ChList="" then return;opstat=pos(MyNick,ChUs);nostat=pos(opnick,ChUs);if opstat>0&nostat>0 then return;ChName=chan.chcnt||"."||Client;interpret "call setclip("ChName", ChUs)";address command RxCmd MCFenv MyNick Unick chan.chcnt line.rest;return;Entry7:;if SPEAK='N' then return;SAbuser=getclip(SAC);if 0 ~=pos(Rnick,SAbuser) then return;parse value line.rest with x1 x2;x1=upper(x1);x2=strip(x2);x3=strip(substr(x1,3));Dst=upper(line.dest);SayLine="";select;when x3=MyNick then SayLine=x2;when Dst=MyNick then SayLine=x3 x2;when 1<length(x1) then;do;call GetCurrUsers();if 0=pos(x3,ChUs) then SayLine=x3 x2;end;otherwise SayLine=x3 x2;end;SayLine=strip(translate(SayLine," ","`\!()_;:'.,?"));if SayLine="" then return;address command "Run <>nil:" SPEAKPLAYER SayLine;return;GetCurrUsers:;channels;ChList=upper(result);if ChList=""|0=pos(Dst,ChList) then;do;ChList="";return;end;do chcnt=1 by 1 until chan.chcnt= Dst;drop result;getchannel chcnt;chan.chcnt=upper(result);end chcnt;drop result;getusers chcnt;ChUs=" "||upper(result)||" ";return;FindPort:;ports=show('P');pnt=0;pxl=pos("AMIRC.",ports);if pxl ~=0 then;ports=substr(ports,pxl);do cnt=1 by 1 until ports="";parse value ports with aport ports;if 0 ~=pos("AMIRC.",aport) then;do;if ~show('C',aport) then;do;pnt=pnt+1;MCFenv=aport;return;end;end;end;if pnt=0 then;do;if ~open('console',"con:0/20/320/160/ MCF Error Screen",'W');then exit 13;len=writeln('console'," ");len=writeln('console'," ");len=writeln('console'," Un-Attached AmIRC ARexx MsgPort NOT Found.");len=writeln('console'," ");len=writeln('console'," ");len=writeln('console'," MCF Terminating!");len=writeln('console'," ");len=writeln('console'," Press Return to close Window");ans=readln('console');call close('console');call setclip("MCF");exit;end;return;AUTO:;parse value idata with junk funct opt junk;if funct="?" then;do;address command "Run <>nil: Rx Rexx:MCF_Auto.AMIRX" MCFenv;return;end;if MyNick=Rnick then;EMcmd="echo P="d2c(27)"««MCF» ";else EMcmd="RAW PRIVMSG "Rnick" :";if funct="USE"|funct="SAVE" then;signal AutoSave;floc=' '||funct||' ';if 0 ~=pos(floc,valid_names) then return;eflag=n;select;when 0 ~=pos(floc,valid_df) then;do;if ""=statef(opt) then eflag='Y';end;when 0 ~=pos(floc,valid_yn) then;do;if 0=pos(opt,"YN") then eflag='Y';end;when funct="GREETS" then;do;if 0=pos(opt,"CNPY") then eflag='Y';end;when funct="NOSOUNDS" then;do;if opt<'0'|opt>'9' then eflag='Y';end;otherwise continue;end;if eflag='Y' then;do;EMcmd|| d2c(2)opt|| d2c(2) " is not a valid value for "d2c(2)funct;return;end;if funct="SOUNDDIR" then;do;lc=right(opt,1);if lc ~=':'&lc ~='/' then opt=opt||'/';end;if funct="DCCDIR" then;do;lc=right(opt,1);if lc ~=':'&lc ~='/' then opt=opt||'/';end;if 0 ~=pos(funct,valid_clips) then;Ifunct=funct||"."||Client;else Ifunct=funct;interpret Ifunct "= opt";if 0 ~=pos(funct,valid_clips) then;interpret "call setclip(Ifunct, "Ifunct")";EMcmd||funct" is now set to "d2c(2)value(Ifunct);return;AutoSave:;if ~open("Output",EnvFName,'W') then return;l.1="$VER: MCF.Startup 4.12 (25.12.96)";l.2="SPEAKPLAYER "||SPEAKPLAYER;l.3="SOUNDPLAYER "||SOUNDPLAYER.Client;l.4="SOUNDDIR "||SOUNDDIR.Client;l.5="DCCDIR "|| DCCDIR;l.6="AJOIN "||AJOIN.Client;l.7="ASEND "||ASEND;l.8="DCCGET "|| DCCGET.Client;l.9="FSERV "||FSERV.Client;l.10="GREETS "||GREETS.Client;l.11="OPS "||OPS.Client;l.12="RCMDS "||RCMDS.Client;l.13="PSOUND "||PSOUND.Client;l.14="SOUNDS "||SOUNDS.Client;l.15="NOSOUNDS "||NOSOUNDS.Client;l.16="SPEAK "||SPEAK;do envcnt=1 by 1 until envcnt=16;call writeln("Output",l.envcnt);end envcnt;call close("Output");EMcmd|| d2c(2)"MCF Config now Saved.";return;AU:;DU:;USERS:;address command RxCmd MCFenv line.rest;return;OPTS:;if MyNick=Rnick then;EMcmd="echo P="d2c(27)"««MCF» ";else EMcmd="RAW PRIVMSG "Rnick" :";EMcmd||"SPEAKPLAYER = "SPEAKPLAYER;EMcmd||"SOUNDPLAYER = "SOUNDPLAYER.Client;EMcmd||"SOUNDDIR = "SOUNDDIR.Client;EMcmd||"DCCDIR = "DCCDIR;EMcmd||"AJOIN = "AJOIN.Client;EMcmd||"ASEND = "ASEND;EMcmd||"DCCGET = "DCCGET.Client;EMcmd||"FSERV = "FSERV.Client;EMcmd||"GREETS = "GREETS.Client;EMcmd||"OPS = "OPS.Client;EMcmd||"RCMDS = "RCMDS.Client;EMcmd||"SOUNDS = "SOUNDS.Client;EMcmd||"PSOUND = "PSOUND.Client;EMcmd||"NOSOUNDS = "NOSOUNDS.Client;EMcmd||"SPEAK = "SPEAK;return;RC:;CTCP_Cmds="";xx="";CmdLine="";if ~open("Input",Cname,'R') then;do;"echo P="d2c(27)"««ERROR»" d2c(2)"MCF:MCF.Cmds file not found.";return;end;do until eof("Input");parse value xx with ctyp ccmd;if ctyp="CTCP" then;CTCP_Cmds=CTCP_Cmds||ccmd;else CmdLine=CmdLine xx;xx=readln("Input");end;call close("Input");CmdLine=CmdLine||" ";CmdLine=upper(CmdLine);call setclip(CMC,CmdLine);return;RU:;xx="";PRIVCH.Client="";OpLine="";if ChCount>0 then;do;do chcntr1=1 by 1 until chcntr1=ChCount;call setclip(OpChan.chcntr1,"");interpret OpChan.chcntr1 '= ""';end chcntr1;ChCount=0;end;if ~open("Input",fname,'R') then;do;"echo P="d2c(27)"««ERROR»" d2c(2)"MCF:MCF.Ops file not found.";return;end;do until eof("Input");parse value xx with cauth cnick chost crest;if cauth="PRIVCH" then;PRIVCH.Client=PRIVCH.Client cnick;else if cauth ~="" then OpLine=OpLine cauth cnick chost;if crest ~="" then;do;do until crest="";parse value crest with pchan cauth crest;pchan='O'||pchan||'.'||Client;chflag='N';if ChCount>0 then;do;do chcntr2=1 by 1 until chcntr2=ChCount;if OpChan.chcntr2=pchan then;chflag='Y';end chcntr2;end;if chflag='N' then;do;interpret pchan '= ""';ChCount=ChCount+1;OpChan.ChCount=pchan;end;interpret pchan "= " pchan " cauth cnick chost";end;end;xx=upper(readln("Input"));end;call close("Input");OpLine=upper(OpLine)||" ";call setclip(OLC,OpLine);if ChCount>0 then;do;do chcntr3=1 by 1 until chcntr3=ChCount;ChOpLine=upper(value(OpChan.chcntr3))||" ";call setclip(OpChan.chcntr3,ChOpLine);end chcntr3;end;return;RE:;EnvLoad:;if ~open("Input",EnvFName,'R') then;do;"echo P="d2c(27)"««ERROR»" d2c(2)"MCF:MCF.Startup file not found.";signal SetEnvClips;end;xx=upper(readln("Input"));do until eof("Input");parse value xx with envname envvalue junk;envloc=' '||envname||' ';elpos=pos(envloc,validnames);vname="";if elpos ~=0 then;do;select;when 0 ~=pos(envloc,valid_df) then;do;if 0 ~=pos("DIR",envname) then;do;lc=right(envvalue,1);if 0=pos(lc,":/") then envvalue=envvalue||'/';end;if ""=statef(envvalue) then;do;vname=envvalue;envvalue="";end;end;when 0 ~=pos(envloc,valid_yn) then;do;if 0=pos(envvalue,"YN") then envvalue="";end;when envname="GREETS" then;do;if 0=pos(envvalue,"CNPY") then envvalue="";end;when envname="NOSOUNDS" then;do;if envvalue<'0'|envvalue>'9' then envvalue="";end;otherwise continue;end;if envvalue ~="" then;interpret envname "= envvalue";else "echo P="d2c(27)"««MCF» Value for "d2c(2) envname" is not valid. "vname;end;xx=upper(readln("Input"));end;call close("Input");SetEnvClips:;if 0 ~=pos("NOOPS",argline) then OPS="N";if 0 ~=pos("FSERV",argline) then FSERV="Y";if 0 ~=pos("NOSOUND",argline) then SOUNDS="N";if 0 ~=pos("NORCMDS",argline) then RCMDS="N";AJOIN.Client=AJOIN;FSERV.Client=FSERV;GREETS.Client=GREETS;OPS.Client=OPS;RCMDS.Client=RCMDS;SOUNDS.Client=SOUNDS;PSOUND.Client=PSOUND;NOSOUNDS.Client=NOSOUNDS;DCCGET.Client= DCCGET;SOUNDPLAYER.Client=SOUNDPLAYER;SOUNDDIR.Client=SOUNDDIR;call setclip(FSC,FSERV.Client);call setclip(OPC,OPS.Client);call setclip(GRC,GREETS.Client);call setclip(SCC,SOUNDS.Client);call setclip(SPC,SOUNDPLAYER.Client);call setclip(PSC,PSOUND.Client);call setclip(NSC,NOSOUNDS.Client);call setclip(DCC, DCCGET.Client);call setclip(SDC,SOUNDDIR.Client);return;QUIT:;if APort ~=0 then;do;"echo P="d2c(27)"««MCF» Quitting at the request of"d2c(2) Unick;if MyNick ~=Rnick then;"Say /Rx Rexx:MCF_Alias %QUIT";end;xx=getclip(DSC);do endb=1 by 1 while xx ~="";parse value xx with sclip xx;call setclip(sclip,"");end endb;clips='|'||show(c,,'|')||'|';loc='.'||Client||'|';xl=1;do qcntr=1 by 1 until xl=0;xl=pos(loc,clips,xl);if xl=0 then iterate qcntr;fl=lastpos('|',clips,xl)+1;len=xl-fl+2;qname=substr(clips,fl,len);zl=pos("ALINE.",qname)+pos("ELINE.",qname);if zl=0 then call setclip(qname,"");xl=xl+1;end qcntr;clips='|'||show(c,,'|')||'|';if 0 ~=pos("|AMIRC.",clips) then exit;call setclip("ALINE.1","");call setclip("ALINE.2","");do endc=0 by 1 until endc=10;call setclip("ELINE."endc,"");end endc;exit